﻿var currRestaurant;

function getNewRestaurant() {
	$.ajax({
		async: false,
		url: "Owner/getNewRestaurant",
		success: function (restaurant) {
			currRestaurant = restaurant;
		},
		error: function (xhr, ajaxOptions, thrownError) {
			document.write(xhr.responseText);
		}
	});
}

function getCurrRestaurant() {
	return currRestaurant;
}

function saveRestaurant() {
	$.ajax({
		type: "POST",
		async: false,
		url: "Owner/saveRestaurant",
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		data: JSON.stringify(getCurrRestaurant()),
		error: function (xhr, ajaxOptions, thrownError) {
			document.write(xhr.responseText);
		}
	});
	location.reload(true);
}

function updateReserve(reserve) {
	$.ajax({
		type: "POST",
		async: false,
		url: "Owner/updateReserve",
		contentType: "application/json; charset=utf-8",
		data: JSON.stringify(reserve),
		error: function (xhr, ajaxOptions, thrownError) {
			document.write(xhr.responseText);
		}
	});
}